リビジョン | d8a2a23da4f357ab8ef87d6db111073696df1699 (tree) |
---|---|
日時 | 2021-09-03 16:25:06 |
作者 | SimonIT <simonit.orig@gmai...> |
コミッター | GitHub |
Improve code formatting (#5698)
* basic spotless integration
* fix formatter path
* line endings lf and tabs for cpp
* Update spotless, format only diffs
* Exclude some folders from ignoring
* Add gwt files in webapp
* Fetch more git information in workflows
* Correct test index.html path
* Move spotless version to dependencies.gradle
@@ -11,6 +11,7 @@ jobs: | ||
11 | 11 | steps: |
12 | 12 | - uses: actions/checkout@v2 |
13 | 13 | with: |
14 | + fetch-depth: 0 | |
14 | 15 | submodules: 'recursive' |
15 | 16 | |
16 | 17 | - name: Set up JDK 1.8 |
@@ -30,9 +31,9 @@ jobs: | ||
30 | 31 | |
31 | 32 | - name: Build & test Java code |
32 | 33 | run: | |
33 | - ./gradlew fetchNatives build | |
34 | + ./gradlew fetchNatives build | |
34 | 35 | |
35 | 36 | - name: Cleanup Gradle Cache |
36 | 37 | run: | |
37 | 38 | rm -f ~/.gradle/caches/modules-2/modules-2.lock |
38 | - rm -f ~/.gradle/caches/modules-2/gc.properties | |
\ No newline at end of file | ||
39 | + rm -f ~/.gradle/caches/modules-2/gc.properties |
@@ -4,7 +4,7 @@ on: | ||
4 | 4 | push: |
5 | 5 | branches: [ master ] |
6 | 6 | workflow_dispatch: |
7 | - branches: [ master ] | |
7 | + branches: [ master ] | |
8 | 8 | |
9 | 9 | jobs: |
10 | 10 |
@@ -13,6 +13,7 @@ jobs: | ||
13 | 13 | steps: |
14 | 14 | - uses: actions/checkout@v2 |
15 | 15 | with: |
16 | + fetch-depth: 0 | |
16 | 17 | submodules: 'recursive' |
17 | 18 | - name: Set up JDK 1.8 |
18 | 19 | uses: actions/setup-java@v1 |
@@ -49,24 +50,25 @@ jobs: | ||
49 | 50 | uses: actions/upload-artifact@v2 |
50 | 51 | with: |
51 | 52 | name: natives-ios.zip |
52 | - path: natives-ios.zip | |
53 | + path: natives-ios.zip | |
53 | 54 | |
54 | 55 | - name: Cleanup Gradle Cache |
55 | 56 | run: | |
56 | 57 | rm -f ~/.gradle/caches/modules-2/modules-2.lock |
57 | 58 | rm -f ~/.gradle/caches/modules-2/gc.properties |
58 | 59 | |
59 | - natives-macos: | |
60 | + natives-macos: | |
60 | 61 | runs-on: macos-latest |
61 | 62 | steps: |
62 | 63 | - uses: actions/checkout@v2 |
63 | 64 | with: |
64 | - submodules: 'recursive' | |
65 | + fetch-depth: 0 | |
66 | + submodules: 'recursive' | |
65 | 67 | - name: Set up JDK 1.8 |
66 | 68 | uses: actions/setup-java@v1 |
67 | 69 | with: |
68 | 70 | java-version: 1.8 |
69 | - | |
71 | + | |
70 | 72 | - name: Cache Gradle packages |
71 | 73 | uses: actions/cache@v2 |
72 | 74 | with: |
@@ -96,18 +98,19 @@ jobs: | ||
96 | 98 | uses: actions/upload-artifact@v2 |
97 | 99 | with: |
98 | 100 | name: natives-macos.zip |
99 | - path: natives-macos.zip | |
101 | + path: natives-macos.zip | |
100 | 102 | |
101 | 103 | - name: Cleanup Gradle Cache |
102 | 104 | run: | |
103 | 105 | rm -f ~/.gradle/caches/modules-2/modules-2.lock |
104 | 106 | rm -f ~/.gradle/caches/modules-2/gc.properties |
105 | 107 | |
106 | - natives-linux: | |
108 | + natives-linux: | |
107 | 109 | runs-on: ubuntu-16.04 |
108 | 110 | steps: |
109 | 111 | - uses: actions/checkout@v2 |
110 | 112 | with: |
113 | + fetch-depth: 0 | |
111 | 114 | submodules: 'recursive' |
112 | 115 | |
113 | 116 | - name: Set up JDK 1.8 |
@@ -119,8 +122,8 @@ jobs: | ||
119 | 122 | run: | |
120 | 123 | sudo apt install -y --force-yes gcc g++ |
121 | 124 | sudo apt install -y --force-yes gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libc6-dev-arm64-cross |
122 | - sudo apt install -y --force-yes gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf libc6-dev-armhf-cross | |
123 | - | |
125 | + sudo apt install -y --force-yes gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf libc6-dev-armhf-cross | |
126 | + | |
124 | 127 | - name: Cache Gradle packages |
125 | 128 | uses: actions/cache@v2 |
126 | 129 | with: |
@@ -132,8 +135,8 @@ jobs: | ||
132 | 135 | ${{ runner.os }}-gradle- |
133 | 136 | |
134 | 137 | - name: Build Linux natives |
135 | - run: | | |
136 | - ./gradlew jniGen jnigenBuildLinux64 jnigenBuildLinuxARM jnigenBuildLinuxARM64 | |
138 | + run: | | |
139 | + ./gradlew jniGen jnigenBuildLinux64 jnigenBuildLinuxARM jnigenBuildLinuxARM64 | |
137 | 140 | |
138 | 141 | - name: Pack artifacts |
139 | 142 | run: | |
@@ -144,18 +147,19 @@ jobs: | ||
144 | 147 | uses: actions/upload-artifact@v2 |
145 | 148 | with: |
146 | 149 | name: natives-linux.zip |
147 | - path: natives-linux.zip | |
150 | + path: natives-linux.zip | |
148 | 151 | |
149 | 152 | - name: Cleanup Gradle Cache |
150 | 153 | run: | |
151 | 154 | rm -f ~/.gradle/caches/modules-2/modules-2.lock |
152 | 155 | rm -f ~/.gradle/caches/modules-2/gc.properties |
153 | 156 | |
154 | - natives-windows: | |
157 | + natives-windows: | |
155 | 158 | runs-on: ubuntu-16.04 |
156 | 159 | steps: |
157 | 160 | - uses: actions/checkout@v2 |
158 | 161 | with: |
162 | + fetch-depth: 0 | |
159 | 163 | submodules: 'recursive' |
160 | 164 | |
161 | 165 | - name: Set up JDK 1.8 |
@@ -164,9 +168,9 @@ jobs: | ||
164 | 168 | java-version: 1.8 |
165 | 169 | |
166 | 170 | - name: Install cross-compilation toolchains |
167 | - run: | | |
168 | - sudo apt install -y --force-yes mingw-w64 lib32z1 | |
169 | - | |
171 | + run: | | |
172 | + sudo apt install -y --force-yes mingw-w64 lib32z1 | |
173 | + | |
170 | 174 | - name: Cache Gradle packages |
171 | 175 | uses: actions/cache@v2 |
172 | 176 | with: |
@@ -178,8 +182,8 @@ jobs: | ||
178 | 182 | ${{ runner.os }}-gradle- |
179 | 183 | |
180 | 184 | - name: Build Windows natives |
181 | - run: | | |
182 | - ./gradlew jniGen jnigenBuildWindows64 jnigenBuildWindows | |
185 | + run: | | |
186 | + ./gradlew jniGen jnigenBuildWindows64 jnigenBuildWindows | |
183 | 187 | |
184 | 188 | - name: Pack artifacts |
185 | 189 | run: | |
@@ -190,25 +194,26 @@ jobs: | ||
190 | 194 | uses: actions/upload-artifact@v2 |
191 | 195 | with: |
192 | 196 | name: natives-windows.zip |
193 | - path: natives-windows.zip | |
197 | + path: natives-windows.zip | |
194 | 198 | |
195 | 199 | - name: Cleanup Gradle Cache |
196 | 200 | run: | |
197 | 201 | rm -f ~/.gradle/caches/modules-2/modules-2.lock |
198 | 202 | rm -f ~/.gradle/caches/modules-2/gc.properties |
199 | 203 | |
200 | - natives-android: | |
204 | + natives-android: | |
201 | 205 | runs-on: ubuntu-16.04 |
202 | 206 | steps: |
203 | 207 | - uses: actions/checkout@v2 |
204 | 208 | with: |
209 | + fetch-depth: 0 | |
205 | 210 | submodules: 'recursive' |
206 | 211 | |
207 | 212 | - name: Set up JDK 1.8 |
208 | 213 | uses: actions/setup-java@v1 |
209 | 214 | with: |
210 | - java-version: 1.8 | |
211 | - | |
215 | + java-version: 1.8 | |
216 | + | |
212 | 217 | - name: Cache Gradle packages |
213 | 218 | uses: actions/cache@v2 |
214 | 219 | with: |
@@ -220,9 +225,9 @@ jobs: | ||
220 | 225 | ${{ runner.os }}-gradle- |
221 | 226 | |
222 | 227 | - name: Build Android natives |
223 | - run: | | |
228 | + run: | | |
224 | 229 | export NDK_HOME=$ANDROID_NDK_HOME |
225 | - ./gradlew jniGen jnigenBuildAndroid | |
230 | + ./gradlew jniGen jnigenBuildAndroid | |
226 | 231 | |
227 | 232 | - name: Pack artifacts |
228 | 233 | run: | |
@@ -233,14 +238,14 @@ jobs: | ||
233 | 238 | uses: actions/upload-artifact@v2 |
234 | 239 | with: |
235 | 240 | name: natives-android.zip |
236 | - path: natives-android.zip | |
241 | + path: natives-android.zip | |
237 | 242 | |
238 | 243 | - name: Cleanup Gradle Cache |
239 | 244 | run: | |
240 | 245 | rm -f ~/.gradle/caches/modules-2/modules-2.lock |
241 | - rm -f ~/.gradle/caches/modules-2/gc.properties | |
246 | + rm -f ~/.gradle/caches/modules-2/gc.properties | |
242 | 247 | |
243 | - pack-natives: | |
248 | + pack-natives: | |
244 | 249 | runs-on: ubuntu-16.04 |
245 | 250 | needs: [natives-macos, natives-linux, natives-windows, natives-ios, natives-android] |
246 | 251 | env: |
@@ -249,6 +254,7 @@ jobs: | ||
249 | 254 | steps: |
250 | 255 | - uses: actions/checkout@v2 |
251 | 256 | with: |
257 | + fetch-depth: 0 | |
252 | 258 | submodules: 'recursive' |
253 | 259 | |
254 | 260 | - name: Set up JDK 1.8 |
@@ -264,7 +270,7 @@ jobs: | ||
264 | 270 | ~/.gradle/wrapper |
265 | 271 | key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} |
266 | 272 | restore-keys: | |
267 | - ${{ runner.os }}-gradle- | |
273 | + ${{ runner.os }}-gradle- | |
268 | 274 | |
269 | 275 | - name: Download natives-ios artifact |
270 | 276 | uses: actions/download-artifact@v2 |
@@ -318,7 +324,7 @@ jobs: | ||
318 | 324 | name: natives.zip |
319 | 325 | path: natives.zip |
320 | 326 | |
321 | - - name: Upload artifacts to S3 | |
327 | + - name: Upload artifacts to S3 | |
322 | 328 | if: env.AWS_ACCESS_KEY_ID != null |
323 | 329 | run: | |
324 | 330 | aws s3 cp natives.zip s3://libgdx-nightlies/libgdx-nightlies/natives.zip |
@@ -326,17 +332,18 @@ jobs: | ||
326 | 332 | - name: Cleanup Gradle Cache |
327 | 333 | run: | |
328 | 334 | rm -f ~/.gradle/caches/modules-2/modules-2.lock |
329 | - rm -f ~/.gradle/caches/modules-2/gc.properties | |
335 | + rm -f ~/.gradle/caches/modules-2/gc.properties | |
330 | 336 | |
331 | - release-snapshot: | |
337 | + release-snapshot: | |
332 | 338 | runs-on: ubuntu-16.04 |
333 | 339 | needs: pack-natives |
334 | 340 | env: |
335 | 341 | MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} |
336 | - MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | |
342 | + MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | |
337 | 343 | steps: |
338 | 344 | - uses: actions/checkout@v2 |
339 | 345 | with: |
346 | + fetch-depth: 0 | |
340 | 347 | submodules: 'recursive' |
341 | 348 | |
342 | 349 | - name: Set up JDK 1.8 |
@@ -346,7 +353,7 @@ jobs: | ||
346 | 353 | server-id: sonatype-nexus-snapshots |
347 | 354 | server-username: MAVEN_USERNAME |
348 | 355 | server-password: MAVEN_PASSWORD |
349 | - | |
356 | + | |
350 | 357 | - name: Cache Maven packages |
351 | 358 | uses: actions/cache@v2 |
352 | 359 | with: |
@@ -354,22 +361,22 @@ jobs: | ||
354 | 361 | key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} |
355 | 362 | restore-keys: ${{ runner.os }}-m2 |
356 | 363 | |
357 | - - name: Download natives artifact | |
364 | + - name: Download natives artifact | |
358 | 365 | uses: actions/download-artifact@v2 |
359 | 366 | with: |
360 | 367 | name: natives.zip |
361 | 368 | |
362 | - - name: Unpack natives | |
369 | + - name: Unpack natives | |
363 | 370 | run: | |
364 | 371 | unzip -o natives.zip |
365 | 372 | |
366 | 373 | - name: Publish snapshot |
367 | 374 | if: env.MAVEN_USERNAME != null |
368 | 375 | run: | |
369 | - mvn --batch-mode deploy | |
370 | - | |
371 | - | |
372 | - build-and-upload-runnables: | |
376 | + mvn --batch-mode deploy | |
377 | + | |
378 | + | |
379 | + build-and-upload-runnables: | |
373 | 380 | runs-on: ubuntu-16.04 |
374 | 381 | env: |
375 | 382 | AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} |
@@ -377,6 +384,7 @@ jobs: | ||
377 | 384 | steps: |
378 | 385 | - uses: actions/checkout@v2 |
379 | 386 | with: |
387 | + fetch-depth: 0 | |
380 | 388 | submodules: 'recursive' |
381 | 389 | |
382 | 390 | - name: Set up JDK 1.8 |
@@ -386,7 +394,7 @@ jobs: | ||
386 | 394 | - name: Build Runnables |
387 | 395 | run: ./gradlew clean fetchNatives buildRunnables extensions:gdx-setup:build |
388 | 396 | |
389 | - - name: Upload artifacts to S3 | |
397 | + - name: Upload artifacts to S3 | |
390 | 398 | if: env.AWS_ACCESS_KEY_ID != null |
391 | 399 | run: | |
392 | 400 | aws s3 cp ./extensions/gdx-tools/build/libs/ s3://libgdx-nightlies/libgdx-runnables/ --recursive |
@@ -0,0 +1 @@ | ||
1 | +!/src/com/badlogic/gwtref/gen/ |
@@ -16,6 +16,18 @@ | ||
16 | 16 | |
17 | 17 | apply from: "gradle/dependencies.gradle" |
18 | 18 | |
19 | +buildscript { | |
20 | + apply from: "gradle/dependencies.gradle" | |
21 | + | |
22 | + repositories { | |
23 | + maven { url "https://plugins.gradle.org/m2/" } | |
24 | + } | |
25 | + dependencies { | |
26 | + classpath "com.diffplug.spotless:spotless-plugin-gradle:${versions.spotless}" | |
27 | + classpath "com.badlogicgames.gdx:gdx-jnigen-gradle:2.2.0" | |
28 | + } | |
29 | +} | |
30 | + | |
19 | 31 | allprojects { |
20 | 32 | group = 'com.badlogicgames.gdx' |
21 | 33 | version = '1.10.0-SNAPSHOT' |
@@ -29,9 +41,6 @@ allprojects { | ||
29 | 41 | maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } |
30 | 42 | maven { url "https://oss.sonatype.org/content/repositories/releases/" } |
31 | 43 | } |
32 | - dependencies { | |
33 | - classpath "com.badlogicgames.gdx:gdx-jnigen-gradle:2.2.0" | |
34 | - } | |
35 | 44 | } |
36 | 45 | |
37 | 46 | repositories { |
@@ -47,15 +56,42 @@ allprojects { | ||
47 | 56 | configure(subprojects - project(":tests:gdx-tests-android")) { |
48 | 57 | apply plugin: "idea" |
49 | 58 | apply plugin: "java" |
59 | + apply plugin: "com.diffplug.spotless" | |
50 | 60 | |
51 | 61 | compileJava { |
52 | 62 | options.fork = true |
53 | 63 | options.incremental = true |
54 | 64 | } |
65 | + | |
66 | + spotless { | |
67 | + ratchetFrom 'origin/master' | |
68 | + | |
69 | + lineEndings 'UNIX' | |
70 | + | |
71 | + java { | |
72 | + licenseHeader '/*******************************************************************************\n' + | |
73 | + ' * Copyright 2011 See AUTHORS file.\n' + | |
74 | + ' * \n' + | |
75 | + ' * Licensed under the Apache License, Version 2.0 (the "License");\n' + | |
76 | + ' * you may not use this file except in compliance with the License.\n' + | |
77 | + ' * You may obtain a copy of the License at\n' + | |
78 | + ' * \n' + | |
79 | + ' * http://www.apache.org/licenses/LICENSE-2.0\n' + | |
80 | + ' * \n' + | |
81 | + ' * Unless required by applicable law or agreed to in writing, software\n' + | |
82 | + ' * distributed under the License is distributed on an "AS IS" BASIS,\n' + | |
83 | + ' * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n' + | |
84 | + ' * See the License for the specific language governing permissions and\n' + | |
85 | + ' * limitations under the License.\n' + | |
86 | + ' ******************************************************************************/\n' | |
87 | + removeUnusedImports() | |
88 | + eclipse().configFile new File(rootProject.projectDir.absolutePath, 'eclipse-formatter.xml') | |
89 | + } | |
90 | + } | |
55 | 91 | } |
56 | 92 | |
57 | 93 | ant.importBuild("fetch.xml") { antTargetName -> |
58 | - "ant-task-" + antTargetName | |
94 | + "ant-task-" + antTargetName | |
59 | 95 | } |
60 | 96 | task fetchNatives(dependsOn: "ant-task-all"){ |
61 | 97 | doLast { |
@@ -0,0 +1 @@ | ||
1 | +!/res/com/badlogic/gdx/setup/resources/html/war |
@@ -38,6 +38,7 @@ versions.androidMinSdk = 14 | ||
38 | 38 | versions.androidBuildTools = "29.0.3" |
39 | 39 | versions.androidFragment = "1.2.3" |
40 | 40 | versions.javaparser = "2.3.0" |
41 | +versions.spotless = "5.14.3" | |
41 | 42 | |
42 | 43 | libraries.lwjgl = [ |
43 | 44 | "org.lwjgl.lwjgl:lwjgl:${versions.lwjgl}", |
@@ -1,25 +1,25 @@ | ||
1 | -<!doctype html> | |
2 | -<html> | |
3 | - <head> | |
4 | - <meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
5 | - <title>libGDX GWT Test Runner</title> | |
6 | - </head> | |
7 | - <body> | |
8 | - <h1>libGDX GWT Test Runner</h1> | |
9 | - UI should load here shortly:<br> | |
10 | - <div id="embed-com.badlogic.gdx.tests.gwt.GdxTestsGwt"></div> | |
11 | - <small>This page is from <code>tests/gdx-tests-gwt/war/index.html</code>. Enter superdev here: | |
12 | - <a class="superdev" href="javascript:%7B%20window.__gwt_bookmarklet_params%20%3D%20%7B'server_url'%3A'http%3A%2F%2Flocalhost%3A9876%2F'%7D%3B%20var%20s%20%3D%20document.createElement('script')%3B%20s.src%20%3D%20'http%3A%2F%2Flocalhost%3A9876%2Fdev_mode_on.js'%3B%20void(document.getElementsByTagName('head')%5B0%5D.appendChild(s))%3B%7D">↻</a> | |
13 | - </small> | |
14 | - <script type="text/javascript" language="javascript" src="com.badlogic.gdx.tests.gwt.GdxTestsGwt/com.badlogic.gdx.tests.gwt.GdxTestsGwt.nocache.js"> | |
15 | -window.onkeydown = | |
16 | - function(event) { | |
17 | - // prevent all navigation keys except the space key | |
18 | - if([9, 33, 34, 35, 36, 37, 38, 39, 40].indexOf(event.keyCode) > -1) { | |
19 | - event.preventDefault(); | |
20 | - return false; | |
21 | - } | |
22 | - }; | |
23 | - </script> | |
24 | - </body> | |
25 | -</html> | |
1 | +<!doctype html> | |
2 | +<html> | |
3 | + <head> | |
4 | + <meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
5 | + <title>libGDX GWT Test Runner</title> | |
6 | + </head> | |
7 | + <body> | |
8 | + <h1>libGDX GWT Test Runner</h1> | |
9 | + UI should load here shortly:<br> | |
10 | + <div id="embed-com.badlogic.gdx.tests.gwt.GdxTestsGwt"></div> | |
11 | + <small>This page is from <code>tests/gdx-tests-gwt/webapp/index.html</code>. Enter superdev here: | |
12 | + <a class="superdev" href="javascript:%7B%20window.__gwt_bookmarklet_params%20%3D%20%7B'server_url'%3A'http%3A%2F%2Flocalhost%3A9876%2F'%7D%3B%20var%20s%20%3D%20document.createElement('script')%3B%20s.src%20%3D%20'http%3A%2F%2Flocalhost%3A9876%2Fdev_mode_on.js'%3B%20void(document.getElementsByTagName('head')%5B0%5D.appendChild(s))%3B%7D">↻</a> | |
13 | + </small> | |
14 | + <script type="text/javascript" language="javascript" src="com.badlogic.gdx.tests.gwt.GdxTestsGwt/com.badlogic.gdx.tests.gwt.GdxTestsGwt.nocache.js"> | |
15 | +window.onkeydown = | |
16 | + function(event) { | |
17 | + // prevent all navigation keys except the space key | |
18 | + if([9, 33, 34, 35, 36, 37, 38, 39, 40].indexOf(event.keyCode) > -1) { | |
19 | + event.preventDefault(); | |
20 | + return false; | |
21 | + } | |
22 | + }; | |
23 | + </script> | |
24 | + </body> | |
25 | +</html> |