Skip to content

Commit

Permalink
Lifecycle API / SPI (wip)
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Feb 13, 2024
1 parent 4248b7d commit bae14ce
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api;

import java.util.List;

import org.apache.maven.api.annotations.Nonnull;
import org.apache.maven.api.model.PluginContainer;

/**
* Lifecycle definition
*/
public interface Lifecycle extends ExtensibleEnum {

String CLEAN = "clean";

String DEFAULT = "default";

String SITE = "site";

/**
* Name or identifier of this lifecycle.
*
* @return the unique identifier for this lifecycle
*/
@Override
String id();

/**
* List of phases for this lifecycle
*
* @return
*/
List<String> phases();

/**
* Default bindings for this lifecycle
*
* @return
*/
@Nonnull
PluginContainer defaultBinding();
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@
*/
package org.apache.maven.api;

import java.util.Optional;

import org.apache.maven.api.annotations.Experimental;
import org.apache.maven.api.annotations.Immutable;
import org.apache.maven.api.annotations.Nonnull;
import org.apache.maven.api.model.PluginContainer;

/**
* Interface representing a Maven project packaging.
Expand Down Expand Up @@ -52,4 +55,11 @@ default Language language() {
*/
@Nonnull
Type getType();

/**
* Returns the binding to use specifically for this packaging.
* This will be merged to the default packaging definition.
*/
@Nonnull
Optional<PluginContainer> getPlugins();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.spi;

import org.apache.maven.api.Lifecycle;
import org.apache.maven.api.annotations.Consumer;
import org.apache.maven.api.annotations.Experimental;

@Experimental
@Consumer
public interface LifecycleProvider extends ExtensibleEnumProvider<Lifecycle> {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.api.spi;

import org.apache.maven.api.Packaging;
import org.apache.maven.api.annotations.Consumer;
import org.apache.maven.api.annotations.Experimental;

@Experimental
@Consumer
public interface PackagingProvider extends ExtensibleEnumProvider<Packaging> {}

0 comments on commit bae14ce

Please sign in to comment.