diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 165b402d..556b60fb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,5 +23,5 @@ jobs: with: java-version: ${{ matrix.java }} - name: Test - run: ./gradlew wrapper --gradle-version=7.3.1 :agent:publishToMavenLocal && ./gradlew wrapper --gradle-version=7.3.1 assemble && ./travis-test.sh + run: ./gradlew :agent:publishToMavenLocal && ./gradlew assemble && ./travis-test.sh diff --git a/.gitignore b/.gitignore index 9d6b2429..fa2f9bda 100755 --- a/.gitignore +++ b/.gitignore @@ -90,7 +90,7 @@ crashlytics.properties crashlytics-build.properties fabric.properties -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +# virtual machine crash logs, see https://www.java.com/en/download/help/error_hotspot.html hs_err_pid* /agent/src/main/scala/*.sc diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 29221124..4bc31508 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -30,6 +30,6 @@ please squash them into a single commit. Let the PR rain begin! [open an issue]: https://github.com/kamon-io/Kamon/issues/new -[mailing list]: https://groups.google.com/forum/#!forum/kamon-user +[mailing list]: https://groups.google.com/g/kamon-user [commit message conventions]: http://spray.io/project-info/contributing/ [CLA]: https://docs.google.com/forms/d/1G_IDrBTFzOMwHvhxfKRBwNtpRelSa_MZ6jecH8lpTlc/viewform diff --git a/README.md b/README.md index 9b6b5311..74744e25 100755 --- a/README.md +++ b/README.md @@ -6,5 +6,5 @@ **Kanela** is a Java Agent written in Java 8+ and powered by [ByteBuddy] with some additionally [ASM] features to provide a simple way to instrument applications running on the JVM and allow introduce Kamon features such as context propagation and metrics. -[ByteBuddy]:http://bytebuddy.net/#/ -[ASM]:http://asm.ow2.org/ +[ByteBuddy]:https://bytebuddy.net/#/ +[ASM]:https://asm.ow2.io/ diff --git a/agent-test/build.gradle b/agent-test/build.gradle index 054eeaa3..a61b2d89 100644 --- a/agent-test/build.gradle +++ b/agent-test/build.gradle @@ -19,23 +19,21 @@ plugins { id 'java' id 'application' id 'scala' - id 'com.github.maiflai.scalatest' version '0.31' + id 'com.github.maiflai.scalatest' version '0.32' } mainClassName = 'app.kanela.JavaMainWithAgent' dependencies { implementation "org.scala-lang:scala-library:${scala_version}" - implementation 'org.slf4j:slf4j-api:1.7.25' - implementation 'ch.qos.logback:logback-core:1.2.3' - implementation 'ch.qos.logback:logback-classic:1.2.3' + implementation 'ch.qos.logback:logback-classic:1.2.11' implementation "io.kamon:kanela-agent:${agent_version}" provided(kamon_agent_dep) - testImplementation 'org.mockito:mockito-core:2.28.2' - testImplementation 'org.scalatest:scalatest_2.12:3.0.8' + testImplementation 'org.mockito:mockito-core:4.6.1' + testImplementation 'org.scalatest:scalatest_2.12:3.2.12' testRuntimeOnly 'org.pegdown:pegdown:1.6.0' } @@ -106,5 +104,5 @@ gradle.taskGraph.whenReady { taskGraph -> KamonAgentTestRunning = result } -test.reports.html.enabled = false +test.reports.html.required = false diff --git a/agent-test/src/main/resources/application.conf b/agent-test/src/main/resources/application.conf index 1e888350..dfbb6f80 100644 --- a/agent-test/src/main/resources/application.conf +++ b/agent-test/src/main/resources/application.conf @@ -1,14 +1,14 @@ kanela { - modules { - example-module { - name = "Example Module" - stoppable = false - instrumentations = [ - "app.kanela.instrumentation.MonitorInstrumentation", - ] - within = [ "app.kanela.cases.+" ] - } + modules { + example-module { + name = "Example Module" + stoppable = false + instrumentations = [ + "app.kanela.instrumentation.MonitorInstrumentation", + ] + within = [ "app\\.kanela\\.cases\\..+" ] } - debug-mode = false - class-dumper.enabled = false -} \ No newline at end of file + } + debug-mode = false + class-dumper.enabled = false +} diff --git a/agent-test/src/test/resources/application.conf b/agent-test/src/test/resources/application.conf index 231c29d2..a45eaf47 100644 --- a/agent-test/src/test/resources/application.conf +++ b/agent-test/src/test/resources/application.conf @@ -10,8 +10,8 @@ kanela { instrumentations = [ ] // written by spec within = [ - "app.kanela..*", - "java.net.*" + "app\\.kanela\\..*", + "java\\.net\\..*", ] bootstrap-injection { diff --git a/agent-test/src/test/scala/app/kanela/specs/AttachInRuntimeSpec.scala b/agent-test/src/test/scala/app/kanela/specs/AttachInRuntimeSpec.scala index 5b891516..40770c1d 100644 --- a/agent-test/src/test/scala/app/kanela/specs/AttachInRuntimeSpec.scala +++ b/agent-test/src/test/scala/app/kanela/specs/AttachInRuntimeSpec.scala @@ -18,11 +18,12 @@ package app.kanela.specs import app.kanela.cases.simple.TestClass import kanela.agent.attacher.Attacher -import org.scalatest.{BeforeAndAfterAll, FlatSpec, Matchers} +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers import scala.collection.mutable.ListBuffer -class AttachInRuntimeSpec extends FlatSpec with Matchers with BeforeAndAfterAll { +class AttachInRuntimeSpec extends AnyFlatSpec with Matchers { "Kanela agent" should "be able to attach in runtime and instrument the loaded classes" in { val testClass = new TestClass() diff --git a/agent-test/src/test/scala/app/kanela/specs/BootstrapInstrumentationSpec.scala b/agent-test/src/test/scala/app/kanela/specs/BootstrapInstrumentationSpec.scala index 97b9ab8c..783408de 100644 --- a/agent-test/src/test/scala/app/kanela/specs/BootstrapInstrumentationSpec.scala +++ b/agent-test/src/test/scala/app/kanela/specs/BootstrapInstrumentationSpec.scala @@ -16,12 +16,13 @@ package app.kanela.specs -import java.net.{HttpURLConnection, URL} - import kanela.agent.attacher.Attacher -import org.scalatest.{BeforeAndAfterAll, FlatSpec, Matchers} +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers + +import java.net.{HttpURLConnection, URL} -class BootstrapInstrumentationSpec extends FlatSpec with Matchers with BeforeAndAfterAll { +class BootstrapInstrumentationSpec extends AnyFlatSpec with Matchers { "The Bootstrap Injection feature" should "provide the necessary helper classes when we instrument the bootstrap class loader" in { Attacher.attach() diff --git a/agent-test/src/test/scala/app/kanela/specs/BridgeInstrumentationSpec.scala b/agent-test/src/test/scala/app/kanela/specs/BridgeInstrumentationSpec.scala index 6b05bcf2..2e8cee96 100644 --- a/agent-test/src/test/scala/app/kanela/specs/BridgeInstrumentationSpec.scala +++ b/agent-test/src/test/scala/app/kanela/specs/BridgeInstrumentationSpec.scala @@ -18,10 +18,10 @@ package app.kanela.specs import app.kanela.cases.bridge.PrivateClass import app.kanela.instrumentation.PrivateClassBridge -import org.scalatest.{BeforeAndAfterAll, FlatSpec, Matchers} +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers - -class BridgeInstrumentationSpec extends FlatSpec with Matchers with BeforeAndAfterAll { +class BridgeInstrumentationSpec extends AnyFlatSpec with Matchers { "The Bridge" should "generate an accessor method for a private field or method" in { val privateClass = new PrivateClass() diff --git a/agent-test/src/test/scala/app/kanela/specs/MultiMixinsInstrumentationSpec.scala b/agent-test/src/test/scala/app/kanela/specs/MultiMixinsInstrumentationSpec.scala index 19c9a2cd..5e2575f6 100644 --- a/agent-test/src/test/scala/app/kanela/specs/MultiMixinsInstrumentationSpec.scala +++ b/agent-test/src/test/scala/app/kanela/specs/MultiMixinsInstrumentationSpec.scala @@ -18,9 +18,10 @@ package app.kanela.specs import app.kanela.cases.multimixins.MixinAware.{MixinAware1, MixinAware2, MixinAware3} import app.kanela.cases.multimixins.WithMultiMixinsClass -import org.scalatest.{BeforeAndAfterAll, FlatSpec, Matchers} +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers -class MultiMixinsInstrumentationSpec extends FlatSpec with Matchers with BeforeAndAfterAll { +class MultiMixinsInstrumentationSpec extends AnyFlatSpec with Matchers { "Multiple Mixins over a single subType" should "introduce all types appropriately" in { diff --git a/agent-test/src/test/scala/app/kanela/specs/SimpleInstrumentationSpec.scala b/agent-test/src/test/scala/app/kanela/specs/SimpleInstrumentationSpec.scala index 01a2ebb5..6e63c3a3 100644 --- a/agent-test/src/test/scala/app/kanela/specs/SimpleInstrumentationSpec.scala +++ b/agent-test/src/test/scala/app/kanela/specs/SimpleInstrumentationSpec.scala @@ -17,11 +17,12 @@ package app.kanela.specs import app.kanela.cases.simple.{SpyAware, TestClass} -import org.scalatest.{FlatSpec, Matchers} +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers import scala.collection.mutable.ListBuffer -class SimpleInstrumentationSpec extends FlatSpec with Matchers { +class SimpleInstrumentationSpec extends AnyFlatSpec with Matchers { "An Advisor with OnMethodEnter and OnMethodExit" should "be able to instrument a specific method of a class" in { val testClass = new TestClass() diff --git a/agent-test/src/test/scala/app/kanela/specs/StoppableInstrumentationSpec.scala b/agent-test/src/test/scala/app/kanela/specs/StoppableInstrumentationSpec.scala index f1ed7e72..058653f0 100644 --- a/agent-test/src/test/scala/app/kanela/specs/StoppableInstrumentationSpec.scala +++ b/agent-test/src/test/scala/app/kanela/specs/StoppableInstrumentationSpec.scala @@ -20,11 +20,12 @@ import app.kanela.cases.simple.TestClass import kanela.agent.attacher.Attacher import kanela.agent.broker.EventBroker import kanela.agent.reinstrument.Reinstrumenter.ReinstrumentationProtocol._ -import org.scalatest.{BeforeAndAfterAll, FlatSpec, Matchers} +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers import scala.collection.mutable.ListBuffer -class StoppableInstrumentationSpec extends FlatSpec with Matchers with BeforeAndAfterAll { +class StoppableInstrumentationSpec extends AnyFlatSpec with Matchers { "A module stoppable" should "be able to retransform and reset instrumentation under critical state" in { val testClass = new TestClass() diff --git a/agent/build.gradle b/agent/build.gradle index 255d4428..1f8fbc14 100644 --- a/agent/build.gradle +++ b/agent/build.gradle @@ -20,8 +20,8 @@ plugins { id 'scala' id 'maven-publish' id 'signing' - id 'com.github.maiflai.scalatest' version '0.31' - id 'com.github.johnrengelman.shadow' version '7.0.0' + id 'com.github.maiflai.scalatest' version '0.32' + id 'com.github.johnrengelman.shadow' version '7.1.2' } configurations { @@ -29,7 +29,7 @@ configurations { } dependencies { - implementation 'com.typesafe:config:1.3.4' + implementation 'com.typesafe:config:1.4.2' implementation 'com.blogspot.mydailyjava:weak-lock-free:0.18' implementation 'org.tinylog:tinylog:1.3.6' @@ -38,8 +38,8 @@ dependencies { implementation files('libs/byte-buddy-1.11.18.jar') - testImplementation 'org.mockito:mockito-core:2.28.2' - testImplementation 'org.scalatest:scalatest_2.12:3.0.1' + testImplementation 'org.mockito:mockito-core:4.6.1' + testImplementation 'org.scalatest:scalatest_2.12:3.2.12' testImplementation "org.scala-lang:scala-library:${scala_version}" testImplementation 'org.pegdown:pegdown:1.6.0' } @@ -48,8 +48,8 @@ def agentBootstrapClasses = 'kanela/agent/bootstrap/**' task bootstrapJar(type: Jar) { // Output to 'bootstrap.jar'. - baseName = 'bootstrap' - version = null + archiveBaseName = 'bootstrap' + archiveVersion = null from sourceSets.main.output include agentBootstrapClasses @@ -58,8 +58,8 @@ task bootstrapJar(type: Jar) { shadowJar.dependsOn bootstrapJar shadowJar { - baseName = 'kanela-agent' - classifier = null + archiveBaseName = 'kanela-agent' + archiveClassifier = null mergeServiceFiles { path = 'META-INF/services/org.pmw.tinylog.*' @@ -88,14 +88,14 @@ shadowJar { } dependencies { - exclude('org.projectlombok:lombok:1.18.20') + exclude('org.projectlombok:lombok:1.18.24') } doLast { def agentBootstrapJar = 'kanela/agent/bootstrap.jar' // Bundle bootstrap.jar. - ant.jar(update: 'true', destfile: shadowJar.archivePath) { + ant.jar(update: 'true', destfile: shadowJar.archiveFile.get()) { mappedresources { fileset(file: bootstrapJar.archivePath) globmapper(from: '*', to: agentBootstrapJar) @@ -123,7 +123,7 @@ def pomConfig = { licenses { license { name "The Apache Software License, Version 2.0" - url "http://www.apache.org/licenses/LICENSE-2.0.txt" + url "https://www.apache.org/licenses/LICENSE-2.0.txt" } } developers { @@ -164,7 +164,7 @@ publishing { def root = asNode() root.appendNode('description', 'The Kamon Instrumentation Agent') root.appendNode('name', 'Kanela') - root.appendNode('url', 'http://kamon.io') + root.appendNode('url', 'https://kamon.io/') root.children().last() + pomConfig } } @@ -211,4 +211,4 @@ classes { dependsOn createBuildInfoFile } -test.reports.html.enabled = false +test.reports.html.required = false diff --git a/agent/src/main/java/kanela/agent/InstrumentationLoader.java b/agent/src/main/java/kanela/agent/InstrumentationLoader.java index cf670e69..e47875c7 100644 --- a/agent/src/main/java/kanela/agent/InstrumentationLoader.java +++ b/agent/src/main/java/kanela/agent/InstrumentationLoader.java @@ -35,13 +35,13 @@ public class InstrumentationLoader { * Load from the current classpath all defined instrumentations {@link InstrumentationBuilder}. * * @param instrumentation {@link Instrumentation} - * @param ctxClassloader {@link ClassLoader} - * @param configuration {@link KanelaConfiguration} + * @param ctxClassloader {@link ClassLoader} + * @param configuration {@link KanelaConfiguration} * @return a list of {@link KanelaFileTransformer} */ public static List load(Instrumentation instrumentation, ClassLoader ctxClassloader, KanelaConfiguration configuration) { return configuration.getAgentModules().map((moduleConfiguration) -> { - Logger.info(() -> format("Loading {0} ", moduleConfiguration.getName())); + Logger.info(() -> format("Loading {0}", moduleConfiguration.getName())); return moduleConfiguration.getInstrumentations() .flatMap(instrumentationClassName -> loadInstrumentation(instrumentationClassName, ctxClassloader)) .filter(kanelaInstrumentation -> kanelaInstrumentation.isEnabled(moduleConfiguration)) @@ -55,7 +55,7 @@ public static List load(Instrumentation instrumentation, private static Option loadInstrumentation(String instrumentationClassName, ClassLoader classLoader) { return Try.of(() -> { Logger.info(() -> format(" ==> Loading {0} ", instrumentationClassName)); - return (InstrumentationBuilder) Class.forName(instrumentationClassName, true, classLoader).newInstance(); + return (InstrumentationBuilder) Class.forName(instrumentationClassName, true, classLoader).getConstructors()[0].newInstance(); }).onFailure((cause) -> Logger.warn(() -> format("Error trying to load Instrumentation: {0} with error: {1}", instrumentationClassName, cause)) ).toOption(); } diff --git a/agent/src/main/java/kanela/agent/api/instrumentation/InstrumentationDescription.java b/agent/src/main/java/kanela/agent/api/instrumentation/InstrumentationDescription.java index 8c3c1b84..180619ac 100644 --- a/agent/src/main/java/kanela/agent/api/instrumentation/InstrumentationDescription.java +++ b/agent/src/main/java/kanela/agent/api/instrumentation/InstrumentationDescription.java @@ -104,12 +104,12 @@ public Builder withInterceptorFor(ElementMatcher.Junction met return this; } - public Builder withTransformation(Function4 f) { + public Builder withTransformation(Function4, TypeDescription, ClassLoader, JavaModule, DynamicType.Builder> f) { transformers.add(withTransformer(f)); return this; } - private AgentBuilder.Transformer withTransformer(Function4 f) { return f::apply; } + private AgentBuilder.Transformer withTransformer(Function4, TypeDescription, ClassLoader, JavaModule, DynamicType.Builder> f) { return f::apply; } public InstrumentationDescription build() { return new InstrumentationDescription(this); diff --git a/agent/src/main/java/kanela/agent/builder/KanelaAgentBuilder.java b/agent/src/main/java/kanela/agent/builder/KanelaAgentBuilder.java index 11c7e13d..3a91b06d 100644 --- a/agent/src/main/java/kanela/agent/builder/KanelaAgentBuilder.java +++ b/agent/src/main/java/kanela/agent/builder/KanelaAgentBuilder.java @@ -24,6 +24,7 @@ import kanela.agent.cache.PoolStrategyCache; import kanela.agent.resubmitter.PeriodicResubmitter; import kanela.agent.util.ListBuilder; +import kanela.agent.util.PatternMatcher; import kanela.agent.util.conf.KanelaConfiguration; import kanela.agent.util.log.Logger; import lombok.Value; @@ -36,6 +37,7 @@ import net.bytebuddy.dynamic.scaffold.MethodGraph; import net.bytebuddy.dynamic.scaffold.TypeValidation; import net.bytebuddy.matcher.ElementMatcher; +import net.bytebuddy.matcher.NameMatcher; import java.lang.instrument.Instrumentation; import java.util.ArrayList; @@ -141,10 +143,20 @@ private AgentBuilder.Listener additionalListeners() { } private ElementMatcher.Junction ignoreMatches() { - return not(nameMatches(moduleDescription.getWithinPackage())); + final String withinPackage = moduleDescription.getWithinPackage(); + if (withinPackage.isEmpty()) { + return any(); + } else { + return not(new NameMatcher<>(new PatternMatcher(withinPackage))); + } } private ElementMatcher.Junction moduleExcludes() { - return nameMatches(moduleDescription.getExcludePackage()); + final String moduleExcludes = moduleDescription.getExcludePackage(); + if (moduleExcludes.isEmpty()) { + return none(); + } else { + return new NameMatcher<>(new PatternMatcher(moduleExcludes)); + } } } diff --git a/agent/src/main/java/kanela/agent/util/PatternMatcher.java b/agent/src/main/java/kanela/agent/util/PatternMatcher.java new file mode 100644 index 00000000..8219b55f --- /dev/null +++ b/agent/src/main/java/kanela/agent/util/PatternMatcher.java @@ -0,0 +1,18 @@ +package kanela.agent.util; + +import net.bytebuddy.matcher.ElementMatcher; + +import java.util.regex.Pattern; + +public class PatternMatcher extends ElementMatcher.Junction.AbstractBase { + private final Pattern regex; + + public PatternMatcher(final String regex) { + this.regex = Pattern.compile(regex); + } + + @Override + public boolean matches(final String target) { + return regex.matcher(target).matches(); + } +} diff --git a/agent/src/main/java/kanela/agent/util/conf/KanelaConfiguration.java b/agent/src/main/java/kanela/agent/util/conf/KanelaConfiguration.java index 01d4d105..b1b2a8ae 100644 --- a/agent/src/main/java/kanela/agent/util/conf/KanelaConfiguration.java +++ b/agent/src/main/java/kanela/agent/util/conf/KanelaConfiguration.java @@ -48,7 +48,7 @@ public class KanelaConfiguration { InstrumentationRegistryConfig instrumentationRegistryConfig; OldGarbageCollectorConfig oldGarbageCollectorConfig; Boolean showBanner; - HashMap extraParams; + HashMap extraParams; Level logLevel; @Getter(AccessLevel.PRIVATE) Config config; @@ -74,7 +74,7 @@ private KanelaConfiguration(Config config) { this.config = config; this.debugMode = getDebugMode(config); this.showBanner = getShowBanner(config); - this.extraParams = new HashMap(); + this.extraParams = new HashMap<>(); this.dump = new DumpConfig(config); this.circuitBreakerConfig = new CircuitBreakerConfig(config); this.instrumentationRegistryConfig = new InstrumentationRegistryConfig(config); @@ -106,7 +106,8 @@ public List getAgentModules() { val disableClassFormatChanges = Try.of(() -> moduleConfig.getBoolean("disable-class-format-changes")).getOrElse(false); return ModuleConfiguration.from( - configPath, name, + configPath, + name, description, instrumentations, within, @@ -280,7 +281,6 @@ private String getExcludeConfiguration(Config config) { if(config.hasPath("exclude")) return getTypeListPattern(config, "exclude").getOrElse(""); return ""; - } private BootstrapInjectionConfig getBootstrapInjectionConfiguration(Config moduleConfig) { diff --git a/agent/src/main/resources/reference.conf b/agent/src/main/resources/reference.conf index 7bab582e..7214da8a 100755 --- a/agent/src/main/resources/reference.conf +++ b/agent/src/main/resources/reference.conf @@ -40,9 +40,9 @@ kanela { # disable-class-format-changes = "true|false" (optional) # # List of fully qualified name of the implementation of kanela.agent.api.instrumentation.InstrumentationBuilderr. # instrumentations = [] - # # Excludes all types that matches the list of patterns. e.g. org.apache. * + # # Excludes all types that match the list of patterns. e.g. org\.apache\..* # exclude = [] - # # Only instruments types that are within the list of patterns. e.g. javax.* + # # Only instruments types that are within the list of patterns. e.g. javax\..* # within = [] # # The exception handler strategy on instrumentation error: LOG|SUPPRESS # exception-handler-strategy = "SUPPRESS" diff --git a/agent/src/test/scala/kanela/agent/InstrumentationLoaderSpec.scala b/agent/src/test/scala/kanela/agent/InstrumentationLoaderSpec.scala index 9195a3be..494be034 100644 --- a/agent/src/test/scala/kanela/agent/InstrumentationLoaderSpec.scala +++ b/agent/src/test/scala/kanela/agent/InstrumentationLoaderSpec.scala @@ -16,17 +16,17 @@ package kanela.agent -import java.lang.instrument.{ClassFileTransformer, Instrumentation} -import org.mockito.Mockito._ -import org.scalatest.{BeforeAndAfterAll, FlatSpec, Matchers} import io.vavr.collection.{List => JList} -import kanela.agent.util.conf.KanelaConfiguration.ModuleConfiguration import kanela.agent.util.conf.KanelaConfiguration -import net.bytebuddy.agent.builder.AgentBuilder.Default.ExecutingTransformer +import kanela.agent.util.conf.KanelaConfiguration.ModuleConfiguration import org.mockito.ArgumentMatchers._ +import org.mockito.Mockito._ +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers -class InstrumentationLoaderSpec extends FlatSpec with Matchers with BeforeAndAfterAll { +import java.lang.instrument.Instrumentation +class InstrumentationLoaderSpec extends AnyFlatSpec with Matchers { "with the config empty kamon.agent.modules.x-module.instrumentations " should "not break" in { val instrumentationMock = mock(classOf[Instrumentation]) @@ -41,6 +41,7 @@ class InstrumentationLoaderSpec extends FlatSpec with Matchers with BeforeAndAft when(agentModuleDescriptionMock.getInstrumentations).thenReturn(JList.empty[String]()) when(agentModuleDescriptionMock.getWithinPackage).thenReturn("") + when(agentModuleDescriptionMock.getExcludePackage).thenReturn("") when(agentModuleDescriptionMock.getName).thenReturn("x-module") InstrumentationLoader.load(instrumentationMock, Thread.currentThread().getContextClassLoader, agentConfiguration) @@ -48,6 +49,9 @@ class InstrumentationLoaderSpec extends FlatSpec with Matchers with BeforeAndAft verify(agentConfiguration, times(1)).getAgentModules } + // TODO FIXME: This test is useless since it explodes before getting to InstrumentationLoader.load + // It should be refactored to expect a specific exception and not a generic RuntimeException + // (currently blowing up due to errorneous spy+mock combo) "with an unknown instrumentation" should "blow up" in { val instrumentationMock = mock(classOf[Instrumentation]) val agentModuleDescriptionMock = mock(classOf[ModuleConfiguration]) @@ -64,7 +68,7 @@ class InstrumentationLoaderSpec extends FlatSpec with Matchers with BeforeAndAft InstrumentationLoader.load(instrumentationMock, Thread.currentThread().getContextClassLoader, agentConfiguration) } - verifyZeroInteractions(instrumentationMock) + verifyNoInteractions(instrumentationMock) } "with an existing instrumentation" should "register it correctly" in { @@ -81,6 +85,7 @@ class InstrumentationLoaderSpec extends FlatSpec with Matchers with BeforeAndAft when(agentModuleDescriptionMock.getInstrumentations).thenReturn(JList.of[String]("kanela.agent.instrumentation.KamonFakeInstrumentationBuilder")) when(agentModuleDescriptionMock.getWithinPackage).thenReturn("") + when(agentModuleDescriptionMock.getExcludePackage).thenReturn("") when(agentModuleDescriptionMock.getName).thenReturn("x-module") InstrumentationLoader.load(instrumentationMock, Thread.currentThread().getContextClassLoader, agentConfiguration) diff --git a/agent/src/test/scala/kanela/agent/bootstrap/CallStackDepth.scala b/agent/src/test/scala/kanela/agent/bootstrap/CallStackDepthSpec.scala similarity index 91% rename from agent/src/test/scala/kanela/agent/bootstrap/CallStackDepth.scala rename to agent/src/test/scala/kanela/agent/bootstrap/CallStackDepthSpec.scala index 75522736..f7b0001b 100644 --- a/agent/src/test/scala/kanela/agent/bootstrap/CallStackDepth.scala +++ b/agent/src/test/scala/kanela/agent/bootstrap/CallStackDepthSpec.scala @@ -17,9 +17,10 @@ package kanela.agent.bootstrap import kanela.agent.bootstrap.stack.CallStackDepth -import org.scalatest.{BeforeAndAfterAll, Matchers, WordSpecLike} +import org.scalatest.matchers.should.Matchers +import org.scalatest.wordspec.AnyWordSpecLike -class CallStackDepth extends Matchers with WordSpecLike with BeforeAndAfterAll { +class CallStackDepthSpec extends AnyWordSpecLike with Matchers { "The CallStackDepth" should { "increment the value in successive calls and then reset" in { val a = new Object diff --git a/agent/src/test/scala/kanela/agent/broker/EventBrokerSpec.scala b/agent/src/test/scala/kanela/agent/broker/EventBrokerSpec.scala index 6c2e16fd..c13f1fe7 100644 --- a/agent/src/test/scala/kanela/agent/broker/EventBrokerSpec.scala +++ b/agent/src/test/scala/kanela/agent/broker/EventBrokerSpec.scala @@ -18,9 +18,10 @@ package kanela.agent.broker import org.mockito.ArgumentMatchers.any import org.mockito.Mockito._ -import org.scalatest.{ BeforeAndAfterAll, Matchers, WordSpecLike } +import org.scalatest.matchers.should.Matchers +import org.scalatest.wordspec.AnyWordSpecLike -class EventBrokerSpec extends Matchers with WordSpecLike with BeforeAndAfterAll { +class EventBrokerSpec extends AnyWordSpecLike with Matchers { "The EventBroker" should { "add an observer" in { val broker = spy(classOf[EventBroker]) diff --git a/agent/src/test/scala/kanela/agent/circuitbreaker/CircuitBreakerSpec.scala b/agent/src/test/scala/kanela/agent/circuitbreaker/CircuitBreakerSpec.scala index 259770f6..53b281ad 100644 --- a/agent/src/test/scala/kanela/agent/circuitbreaker/CircuitBreakerSpec.scala +++ b/agent/src/test/scala/kanela/agent/circuitbreaker/CircuitBreakerSpec.scala @@ -21,14 +21,15 @@ import kanela.agent.util.jvm.{GcEvent, Jvm} import org.mockito.ArgumentMatchers import org.mockito.Mockito._ import org.scalatest.concurrent.Eventually -import org.scalatest.{BeforeAndAfterAll, Matchers, WordSpecLike} +import org.scalatest.matchers.should.Matchers +import org.scalatest.wordspec.AnyWordSpecLike import scala.concurrent.duration._ -class CircuitBreakerSpec extends Matchers with WordSpecLike with BeforeAndAfterAll with Eventually { +class CircuitBreakerSpec extends AnyWordSpecLike with Matchers with Eventually { "The CircuitBreaker" should { "trip when the thresholds are exceeded" in { - eventually(timeout(10 seconds)) { + eventually(timeout(10.seconds)) { val circuitBreakerConfig = spy(KanelaConfiguration.instance().getCircuitBreakerConfig) when(circuitBreakerConfig.getFreeMemoryThreshold).thenReturn(20.0) when(circuitBreakerConfig.getGcProcessCPUThreshold).thenReturn(20.0) diff --git a/agent/src/test/scala/kanela/agent/classloader/ClassloaderNameMatcherSpec.scala b/agent/src/test/scala/kanela/agent/classloader/ClassloaderNameMatcherSpec.scala index 30361fc9..1250b0c0 100644 --- a/agent/src/test/scala/kanela/agent/classloader/ClassloaderNameMatcherSpec.scala +++ b/agent/src/test/scala/kanela/agent/classloader/ClassloaderNameMatcherSpec.scala @@ -20,9 +20,10 @@ import io.vavr.control.Option import kanela.agent.api.instrumentation.InstrumentationBuilder import kanela.agent.api.instrumentation.classloader.{ClassLoaderRefiner, ClassRefiner} import kanela.agent.util.classloader.ClassLoaderNameMatcher.RefinedClassLoaderMatcher -import org.scalatest.{BeforeAndAfterAll, Matchers, WordSpecLike} +import org.scalatest.matchers.should.Matchers +import org.scalatest.wordspec.AnyWordSpecLike -class ClassloaderNameMatcherSpec extends Matchers with WordSpecLike with BeforeAndAfterAll { +class ClassloaderNameMatcherSpec extends AnyWordSpecLike with Matchers { "The ClassloaderNameMatcher" should { "refine the search of a class in an classloader through a ClassRefiner" in { val refiner = ClassRefiner.builder() @@ -94,4 +95,3 @@ class ClassloaderNameMatcherSpec extends Matchers with WordSpecLike with BeforeA } } } - diff --git a/agent/src/test/scala/kanela/agent/util/jvm/OldGarbageCollectorListenerSpec.scala b/agent/src/test/scala/kanela/agent/util/jvm/OldGarbageCollectorListenerSpec.scala index 6c4a22eb..056336b5 100644 --- a/agent/src/test/scala/kanela/agent/util/jvm/OldGarbageCollectorListenerSpec.scala +++ b/agent/src/test/scala/kanela/agent/util/jvm/OldGarbageCollectorListenerSpec.scala @@ -21,14 +21,15 @@ import kanela.agent.util.conf.KanelaConfiguration import org.mockito.ArgumentCaptor import org.mockito.Mockito._ import org.scalatest.concurrent.Eventually -import org.scalatest.{BeforeAndAfterAll, Matchers, WordSpecLike} +import org.scalatest.matchers.should.Matchers +import org.scalatest.wordspec.AnyWordSpecLike import scala.concurrent.duration._ -class OldGarbageCollectorListenerSpec extends Matchers with WordSpecLike with BeforeAndAfterAll with Eventually{ +class OldGarbageCollectorListenerSpec extends AnyWordSpecLike with Matchers with Eventually { "The OldGarbageCollectorListener" should { "receive a event when the GC is triggered" in { - eventually(timeout(10 seconds)) { + eventually(timeout(10.seconds)) { val oldGarbageCollectorConfig = spy(KanelaConfiguration.instance().getOldGarbageCollectorConfig) when(oldGarbageCollectorConfig.isCircuitBreakerRunning).thenReturn(true) when(oldGarbageCollectorConfig.isShouldLogAfterGc).thenReturn(false) diff --git a/build.gradle b/build.gradle index 2c3adb01..867bb773 100644 --- a/build.gradle +++ b/build.gradle @@ -15,7 +15,7 @@ */ buildscript { - ext.scala_version = '2.12.11' + ext.scala_version = '2.12.16' ext.agent_version = project(":agent").version ext.kamon_agent_dep = "io.kamon:kanela-agent:${agent_version}" @@ -42,13 +42,12 @@ allprojects { repositories { mavenLocal() mavenCentral() - jcenter() } dependencies { - implementation 'io.vavr:vavr:0.10.3' - compileOnly 'org.projectlombok:lombok:1.18.20' - annotationProcessor 'org.projectlombok:lombok:1.18.20' + implementation 'io.vavr:vavr:0.10.4' + compileOnly 'org.projectlombok:lombok:1.18.24' + annotationProcessor 'org.projectlombok:lombok:1.18.24' agent(kamon_agent_dep) } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 5c2d1cf0..7454180f 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 3c4101c3..aa991fce 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index b0d6d0ab..c53aefaa 100755 --- a/gradlew +++ b/gradlew @@ -1,13 +1,13 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, @@ -17,78 +17,113 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -97,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -105,84 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=$((i+1)) + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 15e1ee37..ac1b06f9 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -5,7 +5,7 @@ @rem you may not use this file except in compliance with the License. @rem You may obtain a copy of the License at @rem -@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem https://www.apache.org/licenses/LICENSE-2.0 @rem @rem Unless required by applicable law or agreed to in writing, software @rem distributed under the License is distributed on an "AS IS" BASIS, @@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @@ -37,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -51,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -61,28 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/project/build.properties b/project/build.properties deleted file mode 100644 index 31334bbd..00000000 --- a/project/build.properties +++ /dev/null @@ -1 +0,0 @@ -sbt.version=1.1.1