From 56cb3ec4fe54dbc5e90265d89da365cf0002a408 Mon Sep 17 00:00:00 2001 From: Sung Powley Date: Thu, 27 Apr 2023 00:51:00 -0400 Subject: [PATCH] #64 revisions: working demo for desktop, html, and Android Android demo now works without conflict with HTML, desktop demos. Android Gradle Plugin / Gradle versions cannot exceed the following without unresolved errors. Android Gradle Plugin Version: 7.4.2 Gradle Version: 7.5.1 --- build.gradle | 57 ++--- demo/android/AndroidManifest.xml | 1 - demo/android/build.gradle | 210 ++++++++++-------- .../net/mgsx/gltf/demo/AndroidLauncher.java | 16 +- demo/core/build.gradle | 21 +- demo/desktop/build.gradle | 82 +++---- demo/html/build.gradle | 160 ++++++------- gltf/build.gradle | 36 +-- gradle/wrapper/gradle-wrapper.properties | 6 +- ibl-composer/build.gradle | 83 +++---- settings.gradle | 2 +- 11 files changed, 360 insertions(+), 314 deletions(-) diff --git a/build.gradle b/build.gradle index 99ede6bb..5209f0ae 100644 --- a/build.gradle +++ b/build.gradle @@ -1,37 +1,38 @@ buildscript { - repositories { - gradlePluginPortal() - google() - mavenLocal() - mavenCentral() - maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } - } - dependencies { - classpath 'com.android.tools.build:gradle:7.4.2' - } + repositories { + gradlePluginPortal() + google() + mavenLocal() + mavenCentral() + maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } + } + dependencies { + classpath "org.wisepersist:gwt-gradle-plugin:$gwtPluginVersion" + classpath 'com.android.tools.build:gradle:7.4.2' + } } allprojects { - group = 'com.github.mgsx-dev.gdx-gltf' - version = '2.1.0' + group = 'com.github.mgsx-dev.gdx-gltf' + version = '2.1.0' - ext { - gdxVersion = '1.11.0' - junitVersion = '4.13.2' - } + ext { + gdxVersion = '1.11.0' + junitVersion = '4.13.2' + } - repositories { - gradlePluginPortal() - google() - mavenLocal() - mavenCentral() - maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } - maven { url "https://oss.sonatype.org/content/repositories/releases/" } - maven { url "https://jitpack.io" } - } + repositories { + gradlePluginPortal() + google() + mavenLocal() + mavenCentral() + maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } + maven { url "https://oss.sonatype.org/content/repositories/releases/" } + maven { url "https://jitpack.io" } + } - apply plugin: "eclipse" - apply plugin: "idea" + apply plugin: "eclipse" + apply plugin: "idea" } -eclipse.project.name = "gltf-root" +eclipse.project.name = "gltf-root" \ No newline at end of file diff --git a/demo/android/AndroidManifest.xml b/demo/android/AndroidManifest.xml index 51d3f0fc..41ce3af0 100644 --- a/demo/android/AndroidManifest.xml +++ b/demo/android/AndroidManifest.xml @@ -13,7 +13,6 @@ android:name="net.mgsx.gltf.demo.AndroidLauncher" android:configChanges="keyboard|keyboardHidden|orientation|screenSize" android:exported="true" - android:label="@string/app_name" android:screenOrientation="landscape"> diff --git a/demo/android/build.gradle b/demo/android/build.gradle index da8c3f87..4802eb04 100644 --- a/demo/android/build.gradle +++ b/demo/android/build.gradle @@ -3,46 +3,48 @@ apply plugin: "com.android.application" configurations { natives } dependencies { - implementation project(":demo:core") - implementation "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion" - natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a" - natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a" - natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86" - natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64" - + implementation project(":demo:core") + implementation "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion" + natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a" + natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a" + natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86" + natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64" } android { - compileSdkVersion 33 - sourceSets { - main { - manifest.srcFile 'AndroidManifest.xml' - java.srcDirs = ['src'] - aidl.srcDirs = ['src'] - renderscript.srcDirs = ['src'] - res.srcDirs = ['res'] - assets.srcDirs = ['assets'] - jniLibs.srcDirs = ['libs'] - } - - androidTest.setRoot('tests') - } - packagingOptions { - exclude 'META-INF/robovm/ios/robovm.xml' + namespace "net.mgsx.gltf.demo" + compileSdkVersion 33 + sourceSets { + main { + manifest.srcFile 'AndroidManifest.xml' + java.srcDirs = ['src'] + aidl.srcDirs = ['src'] + renderscript.srcDirs = ['src'] + res.srcDirs = ['res'] + assets.srcDirs = ['assets'] + jniLibs.srcDirs = ['libs'] } - defaultConfig { - applicationId "net.mgsx.gltf.demo" - minSdkVersion 24 - targetSdkVersion 33 - versionCode 4 - versionName "0.0.4" + + androidTest.setRoot('tests') + } + packagingOptions { + resources { + excludes += ['META-INF/robovm/ios/robovm.xml'] } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } + } + defaultConfig { + applicationId "net.mgsx.gltf.demo" + minSdkVersion 24 + targetSdkVersion 33 + versionCode 4 + versionName "0.0.4" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } + } } @@ -50,77 +52,107 @@ android { // the natives configuration, and extracts them to the proper libs/ folders // so they get packed with the APK. task copyAndroidNatives() { - doFirst { - file("libs/armeabi/").mkdirs() - file("libs/armeabi-v7a/").mkdirs() - file("libs/arm64-v8a/").mkdirs() - file("libs/x86_64/").mkdirs() - file("libs/x86/").mkdirs() - - configurations.natives.copy().files.each { jar -> - def outputDir = null - if (jar.name.endsWith("natives-arm64-v8a.jar")) outputDir = file("libs/arm64-v8a") - if (jar.name.endsWith("natives-armeabi-v7a.jar")) outputDir = file("libs/armeabi-v7a") - if (jar.name.endsWith("natives-armeabi.jar")) outputDir = file("libs/armeabi") - if (jar.name.endsWith("natives-x86_64.jar")) outputDir = file("libs/x86_64") - if (jar.name.endsWith("natives-x86.jar")) outputDir = file("libs/x86") - if (outputDir != null) { - copy { - from zipTree(jar) - into outputDir - include "*.so" - } - } + doFirst { + file("libs/armeabi-v7a/").mkdirs(); + file("libs/arm64-v8a/").mkdirs(); + file("libs/x86_64/").mkdirs(); + file("libs/x86/").mkdirs(); + + configurations.natives.copy().files.each { jar -> + def outputDir = null + if (jar.name.endsWith("natives-arm64-v8a.jar")) outputDir = file("libs/arm64-v8a") + if (jar.name.endsWith("natives-armeabi-v7a.jar")) outputDir = file("libs/armeabi-v7a") + if (jar.name.endsWith("natives-x86_64.jar")) outputDir = file("libs/x86_64") + if (jar.name.endsWith("natives-x86.jar")) outputDir = file("libs/x86") + if (outputDir != null) { + copy { + from zipTree(jar) + into outputDir + include "*.so" } + } } + } } tasks.whenTaskAdded { packageTask -> - if (packageTask.name.contains("package")) { - packageTask.dependsOn "copyAndroidNatives" - } + if (packageTask.name.contains("package")) { + packageTask.dependsOn "copyAndroidNatives" + } } task run(type: Exec) { - def path - def localProperties = project.file("../local.properties") - if (localProperties.exists()) { - Properties properties = new Properties() - localProperties.withInputStream { instr -> - properties.load(instr) - } - def sdkDir = properties.getProperty('sdk.dir') - if (sdkDir) { - path = sdkDir - } else { - path = "$System.env.ANDROID_HOME" - } + def path + def localProperties = project.file("../local.properties") + if (localProperties.exists()) { + Properties properties = new Properties() + localProperties.withInputStream { instr -> + properties.load(instr) + } + def sdkDir = properties.getProperty('sdk.dir') + if (sdkDir) { + path = sdkDir } else { - path = "$System.env.ANDROID_HOME" + path = "$System.env.ANDROID_HOME" } + } else { + path = "$System.env.ANDROID_HOME" + } - def adb = path + "/platform-tools/adb" - commandLine "$adb", 'shell', 'am', 'start', '-n', 'com.mygdx.game/com.mygdx.game.AndroidLauncher' + def adb = path + "/platform-tools/adb" + commandLine "$adb", 'shell', 'am', 'start', '-n', 'com.mygdx.game/com.mygdx.game.AndroidLauncher' +} + +// sets up the Android Eclipse project, using the old Ant based build. +eclipse { + // need to specify Java source sets explicitly, SpringSource Gradle Eclipse plugin + // ignores any nodes added in classpath.file.withXml + sourceSets { + main { + java.srcDirs "src", 'gen' + } + } + + jdt { + sourceCompatibility = 1.6 + targetCompatibility = 1.6 + } + + classpath { + plusConfigurations += [project.configurations.natives] + containers 'com.android.ide.eclipse.adt.ANDROID_FRAMEWORK', 'com.android.ide.eclipse.adt.LIBRARIES' + } + + project { + name = appName + "-android" + natures 'com.android.ide.eclipse.adt.AndroidNature' + buildCommands.clear(); + buildCommand "com.android.ide.eclipse.adt.ResourceManagerBuilder" + buildCommand "com.android.ide.eclipse.adt.PreCompilerBuilder" + buildCommand "org.eclipse.jdt.core.javabuilder" + buildCommand "com.android.ide.eclipse.adt.ApkBuilder" + } } // sets up the Android Idea project, using the old Ant based build. idea { - module { - sourceDirs += file("src"); - - iml { - withXml { - def node = it.asNode() - def builder = NodeBuilder.newInstance(); - builder.current = node; - builder.component(name: "FacetManager") { - facet(type: "android", name: "Android") { - configuration { - option(name: "UPDATE_PROPERTY_FILES", value:"true") - } - } - } + module { + sourceDirs += file("src"); + scopes = [COMPILE: [plus: [project.configurations.natives]]] + + iml { + withXml { + def node = it.asNode() + def builder = NodeBuilder.newInstance(); + builder.current = node; + builder.component(name: "FacetManager") { + facet(type: "android", name: "Android") { + configuration { + option(name: "UPDATE_PROPERTY_FILES", value: "true") } + } } + } } + } } diff --git a/demo/android/src/net/mgsx/gltf/demo/AndroidLauncher.java b/demo/android/src/net/mgsx/gltf/demo/AndroidLauncher.java index 85c5dc3d..871b1bd8 100644 --- a/demo/android/src/net/mgsx/gltf/demo/AndroidLauncher.java +++ b/demo/android/src/net/mgsx/gltf/demo/AndroidLauncher.java @@ -6,12 +6,12 @@ import android.os.Bundle; public class AndroidLauncher extends AndroidApplication { - @Override - protected void onCreate (Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - GLTFDemo.AUTOLOAD_ENTRY = "BoomBox"; - GLTFDemo.AUTOLOAD_VARIANT = "glTF"; - AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); - initialize(new GLTFDemo("models"), config); - } + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + GLTFDemo.AUTOLOAD_ENTRY = "BoomBox"; + GLTFDemo.AUTOLOAD_VARIANT = "glTF"; + AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); + initialize(new GLTFDemo("models"), config); + } } diff --git a/demo/core/build.gradle b/demo/core/build.gradle index 320645f4..58e68e49 100644 --- a/demo/core/build.gradle +++ b/demo/core/build.gradle @@ -1,18 +1,23 @@ apply plugin: "java" dependencies { - implementation project(":gltf") - implementation "com.badlogicgames.gdx:gdx:$gdxVersion" - testImplementation "junit:junit:$junitVersion" - testImplementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" - testImplementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" + implementation project(":gltf") + implementation "com.badlogicgames.gdx:gdx:$gdxVersion" + + testImplementation "junit:junit:$junitVersion" + testImplementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" + testImplementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" +} + +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 } [compileJava, compileTestJava]*.options*.encoding = 'UTF-8' -sourceSets.main.java.srcDirs = [ "src/" ] +sourceSets.main.java.srcDirs = ["src/"] sourceSets.main.resources.srcDirs = ["src"] -sourceSets.test.java.srcDirs = [ "test/" ] - +sourceSets.test.java.srcDirs = ["test/"] eclipse.project.name = appName + "-core" \ No newline at end of file diff --git a/demo/desktop/build.gradle b/demo/desktop/build.gradle index e1ac5865..83394613 100644 --- a/demo/desktop/build.gradle +++ b/demo/desktop/build.gradle @@ -1,55 +1,55 @@ -apply plugin: 'java' +apply plugin: 'application' dependencies { - implementation project(":demo:core") - implementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" - implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" - implementation project(path: ':gltf') + implementation project(":demo:core") + implementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" + implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" + implementation project(path: ':gltf') } -sourceSets.main.java.srcDirs = [ "src/" ] -sourceSets.test.java.srcDirs = [ "test/" ] +java { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 +} + +sourceSets.main.java.srcDirs = ["src/"] +sourceSets.test.java.srcDirs = ["test/"] project.ext.mainClassName = "net.mgsx.gltf.demo.DesktopLauncher" project.ext.assetsDir = new File("../android/assets"); - -task run(dependsOn: classes, type: JavaExec) { - main = project.mainClassName - classpath = sourceSets.main.runtimeClasspath - standardInput = System.in - workingDir = project.assetsDir - ignoreExitValue = true +run { + main = project.mainClassName + classpath = sourceSets.main.runtimeClasspath + standardInput = System.in + workingDir = project.assetsDir + ignoreExitValue = true } -task debug(dependsOn: classes, type: JavaExec) { - main = project.mainClassName - classpath = sourceSets.main.runtimeClasspath - standardInput = System.in - workingDir = project.assetsDir - ignoreExitValue = true - debug = true +jar { + archiveBaseName.set("$appName-desktop") + duplicatesStrategy(DuplicatesStrategy.EXCLUDE) + dependsOn configurations.runtimeClasspath + from '../android/assets' + exclude 'models' + from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } + exclude('META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA') + dependencies { + exclude('META-INF/INDEX.LIST', 'META-INF/maven/**') + } + manifest { + attributes 'Main-Class': project.mainClassName + } + doLast { + file(archiveFile).setExecutable(true, false) + } } -task distDesktop(type: Jar, dependsOn: [classes]) { - from files(sourceSets.main.output.classesDirs) - from files(sourceSets.main.output.resourcesDir) - from {configurations.compile.collect {zipTree(it)}} - from files(project.assetsDir) - - exclude("models") - - // additional files could be added like this : - // from file("$projectDir/LICENSE"); - - manifest { - attributes 'Main-Class': project.mainClassName - } - doLast { - file(archivePath).setExecutable(true, false) - } +task distDesktop(dependsOn: [jar]) { } -java { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + +eclipse { + project { + name = appName + "-desktop" + } } \ No newline at end of file diff --git a/demo/html/build.gradle b/demo/html/build.gradle index c305c15c..4d216450 100644 --- a/demo/html/build.gradle +++ b/demo/html/build.gradle @@ -1,40 +1,38 @@ buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath "org.gretty:gretty:3.0.7" - } + repositories { + mavenCentral() + } + dependencies { + classpath "org.gretty:gretty:3.0.7" + } } apply plugin: "gwt" apply plugin: "war" apply plugin: "org.gretty" dependencies { - implementation project(":demo:core") - implementation "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion" - implementation "com.badlogicgames.gdx:gdx:$gdxVersion:sources" - implementation "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources" - + implementation project(":demo:core") + implementation "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion" + implementation "com.badlogicgames.gdx:gdx:$gdxVersion:sources" + implementation "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources" } gwt { - gwtVersion="$gwtFrameworkVersion" // Should match the gwt version used for building the gwt backend - maxHeapSize="1G" // Default 256m is not enough for gwt compiler. GWT is HUNGRY - minHeapSize="1G" - - src = files(file("src/")) // Needs to be in front of "modules" below. - modules 'net.mgsx.gltf.demo.GdxDefinition' - devModules 'net.mgsx.gltf.demo.GdxDefinitionSuperdev' - project.webAppDirName = 'webapp' - - compiler { - strict = true; - disableCastChecking = true; - } + gwtVersion = "$gwtFrameworkVersion" // Should match the gwt version used for building the gwt backend + maxHeapSize = "1G" // Default 256m is not enough for gwt compiler. GWT is HUNGRY + minHeapSize = "1G" + + src = files(file("src/")) // Needs to be in front of "modules" below. + modules 'net.mgsx.gltf.demo.GdxDefinition' + devModules 'net.mgsx.gltf.demo.GdxDefinitionSuperdev' + project.webAppDirName = 'webapp' + + compiler { + strict = true; + disableCastChecking = true; + } } - import org.akhikhl.gretty.AppBeforeIntegrationTestTask import org.wisepersist.gradle.plugins.gwt.GwtSuperDev @@ -43,34 +41,34 @@ gretty.resourceBase = project.buildDir.path + "/gwt/draftOut" gretty.contextPath = "/" gretty.portPropertiesFileName = "TEMP_PORTS.properties" -task startHttpServer (dependsOn: [draftCompileGwt]) { - doFirst { - copy { - from "webapp" - into gretty.resourceBase - } - copy { - from "war" - into gretty.resourceBase - } +task startHttpServer(dependsOn: [draftCompileGwt]) { + doFirst { + copy { + from "webapp" + into gretty.resourceBase + } + copy { + from "war" + into gretty.resourceBase } + } } task beforeRun(type: AppBeforeIntegrationTestTask, dependsOn: startHttpServer) { - // The next line allows ports to be reused instead of - // needing a process to be manually terminated. - file("build/TEMP_PORTS.properties").delete() - // Somewhat of a hack; uses Gretty's support for wrapping a task in - // a start and then stop of a Jetty server that serves files while - // also running the SuperDev code server. - integrationTestTask 'superDev' - - interactive false + // The next line allows ports to be reused instead of + // needing a process to be manually terminated. + file("build/TEMP_PORTS.properties").delete() + // Somewhat of a hack; uses Gretty's support for wrapping a task in + // a start and then stop of a Jetty server that serves files while + // also running the SuperDev code server. + integrationTestTask 'superDev' + + interactive false } task superDev(type: GwtSuperDev) { - doFirst { - gwt.modules = gwt.devModules - } + doFirst { + gwt.modules = gwt.devModules + } } // This next line can be changed if you want to, for instance, always build into the // docs/ folder of a Git repo, which can be set to automatically publish on GitHub Pages. @@ -78,54 +76,58 @@ task superDev(type: GwtSuperDev) { var outputPath = "build/dist/" task distWeb(dependsOn: [clean, compileGwt]) { - doLast { - file(outputPath).mkdirs() - copy { - from("build/gwt/out"){ - exclude '**/*.symbolMap' // Not used by a dist, and these can be large. - exclude 'WEB-INF', 'html/clear.cache.gif', 'html/html.devmode.js' - } - into outputPath - } - copy { - from("webapp") { - exclude 'WEB-INF' - } - into outputPath - } - copy { - from "war" - into outputPath - exclude 'WEB-INF' - } + doLast { + file(outputPath).mkdirs() + copy { + from("build/gwt/out") { + exclude '**/*.symbolMap' // Not used by a dist, and these can be large. + exclude 'WEB-INF', 'html/clear.cache.gif', 'html/html.devmode.js' + } + into outputPath } + copy { + from("webapp") { + exclude 'WEB-INF' + } + into outputPath + } + copy { + from "war" + into outputPath + exclude 'WEB-INF' + } + } } task validateDistWeb(type: Exec /*, dependsOn: distWeb*/) { - commandLine 'ruby', '-e', "require 'sinatra' ; set public_folder: '$buildDir/dist' ; set bind: '0.0.0.0'" + commandLine 'ruby', '-e', "require 'sinatra' ; set public_folder: '$buildDir/dist' ; set bind: '0.0.0.0'" } -task distWebZip(type: Zip, dependsOn: distWeb){ - from(outputPath) - archiveBaseName.set("dist-${version}.zip") - destinationDir(file("build")) +task distWebZip(type: Zip, dependsOn: distWeb) { + from(outputPath) + archiveBaseName.set("dist-${version}.zip") + destinationDir(file("build")) } task addSource { - doLast { - sourceSets.main.compileClasspath += files(project(':gltf').sourceSets.main.allJava.srcDirs) - sourceSets.main.compileClasspath += files(project(':demo:core').sourceSets.main.allJava.srcDirs) - } + doLast { + sourceSets.main.compileClasspath += files(project(':gltf').sourceSets.main.allJava.srcDirs) + sourceSets.main.compileClasspath += files(project(':demo:core').sourceSets.main.allJava.srcDirs) + } } tasks.compileGwt.dependsOn(addSource) tasks.draftCompileGwt.dependsOn(addSource) tasks.checkGwt.dependsOn(addSource) -sourceCompatibility = 1.7 -sourceSets.main.java.srcDirs = [ "src/" ] +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 +} + +sourceSets.main.java.srcDirs = ["src/"] eclipse.project { - name = appName + "-html" + name = appName + "-html" } diff --git a/gltf/build.gradle b/gltf/build.gradle index 75c28e58..f22ffd17 100644 --- a/gltf/build.gradle +++ b/gltf/build.gradle @@ -3,34 +3,36 @@ eclipse.project.name = "gdx-gltf" apply plugin: "java" dependencies { - implementation "com.badlogicgames.gdx:gdx:$gdxVersion" - testImplementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" - testImplementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" - testImplementation "junit:junit:$junitVersion" + implementation "com.badlogicgames.gdx:gdx:$gdxVersion" + + testImplementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" + testImplementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" + testImplementation "junit:junit:$junitVersion" } -sourceSets.main.java.srcDirs = [ "src" ] +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 +} + +sourceSets.main.java.srcDirs = ["src"] sourceSets.main.resources.srcDirs = ["src"] -sourceSets.test.java.srcDirs = [ "test" ] +sourceSets.test.java.srcDirs = ["test"] sourceSets.test.resources.srcDirs = ["testRes"] -[compileJava, compileTestJava]*.options*.encoding = 'UTF-8' - task sourcesJar(type: Jar) { - duplicatesStrategy = 'exclude' - from sourceSets.main.allSource + duplicatesStrategy = 'exclude' + classifier = 'sources' + from sourceSets.main.allSource } javadoc { - failOnError = false + failOnError = false } -java { - withSourcesJar() - withJavadocJar() -} +[compileJava, compileTestJava]*.options*.encoding = 'UTF-8' java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + withSourcesJar() + withJavadocJar() } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 85fd61dc..c834fbe5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Apr 03 00:42:37 EDT 2023 +#Wed Apr 26 09:30:35 EDT 2023 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip distributionPath=wrapper/dists -zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/ibl-composer/build.gradle b/ibl-composer/build.gradle index cd1aaeb2..dc0dbeee 100644 --- a/ibl-composer/build.gradle +++ b/ibl-composer/build.gradle @@ -1,62 +1,67 @@ -apply plugin: 'java' +apply plugin: 'application' ext { - appName = "gdx-gltf-ibl-composer" + appName = "gdx-gltf-ibl-composer" } eclipse.project.name = appName - dependencies { - implementation project(":gltf") - implementation "com.badlogicgames.gdx:gdx:$gdxVersion" - implementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" - implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" - + implementation project(":gltf") + implementation "com.badlogicgames.gdx:gdx:$gdxVersion" + implementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" + implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" +} + +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 } -sourceSets.main.java.srcDirs = [ "src/" ] +sourceSets.main.java.srcDirs = ["src/"] sourceSets.main.resources.srcDirs = ["src"] -sourceSets.test.java.srcDirs = [ "test/" ] +sourceSets.test.java.srcDirs = ["test/"] project.ext.mainClassName = "net.mgsx.gltf.ibl.IBLComposerLauncher" project.ext.assetsDir = new File("assets"); - -task run(dependsOn: classes, type: JavaExec) { - main = project.mainClassName - classpath = sourceSets.main.runtimeClasspath - standardInput = System.in - workingDir = project.assetsDir - ignoreExitValue = true +run { + workingDir = 'assets' + setIgnoreExitValue(true) } -task debug(dependsOn: classes, type: JavaExec) { - main = project.mainClassName - classpath = sourceSets.main.runtimeClasspath - standardInput = System.in - workingDir = project.assetsDir - ignoreExitValue = true - debug = true +jar { + archiveBaseName.set('IBL-Composer') + duplicatesStrategy(DuplicatesStrategy.EXCLUDE) + dependsOn configurations.runtimeClasspath + from 'assets' + from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } + exclude('META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA') + dependencies { + exclude('META-INF/INDEX.LIST', 'META-INF/maven/**') + } + manifest { + attributes 'Main-Class': project.mainClassName + } + doLast { + file(archiveFile).setExecutable(true, false) + } } -task distIBL(type: Jar, dependsOn: [classes]) { - from files(sourceSets.main.output.classesDirs) - from files(sourceSets.main.output.resourcesDir) - from {configurations.compile.collect {zipTree(it)}} - from files(project.assetsDir) +task distIBL(dependsOn: [jar]) { +} - // additional files could be added like this : - // from file("$projectDir/LICENSE"); +task sourcesJar(type: Jar) { + duplicatesStrategy = 'exclude' + classifier = 'sources' + from sourceSets.main.allSource +} - manifest { - attributes 'Main-Class': project.mainClassName - } - doLast { - file(archivePath).setExecutable(true, false) - } +javadoc { + failOnError = false } + java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + withSourcesJar() + withJavadocJar() } \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 3ea0f910..46ac2f79 100644 --- a/settings.gradle +++ b/settings.gradle @@ -4,6 +4,6 @@ include ":demo" include ":demo:core" include ":demo:desktop" include ":demo:android" -//include ":demo:html" +include ":demo:html" include ":ibl-composer" \ No newline at end of file